#include <stdio.h>

int sum(int *arr, int n) {
    int i, s = 0;
    for (i = 0; i < n; i++)
        s += arr[i];
    return s;
}

int main() {
    int i;
    int b[5] = {1, 4, 5, 7, 9};
    printf("%d\n", sum(b, 5));
    printf("%d\n", sum(b, 3)); // 1+4
    printf("%d\n", sum(b + 1, 3)); // 4+5+7
    printf("%d\n", sum(&b[2], 3));// 5+7+9
    return 0;


}